<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Test whether an archive is broken (incomplete)</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="rararchive.getentry.html">« RarArchive::getEntry</a></li>
      <li style="float: right;"><a href="rararchive.issolid.html">RarArchive::isSolid »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.rararchive.html">RarArchive</a></li>
    <li>Test whether an archive is broken (incomplete)</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="rararchive.isbroken" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">RarArchive::isBroken</h1>
  <h1 class="refname">rar_broken_is</h1>
  <p class="verinfo">(PECL rar &gt;= 3.0.0)</p><p class="refpurpose"><span class="refname">RarArchive::isBroken</span> -- <span class="refname">rar_broken_is</span> &mdash; <span class="dc-title">Test whether an archive is broken (incomplete)</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-rararchive.isbroken-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>RarArchive::isBroken</strong></span>(): <span class="type">bool</span></div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>rar_broken_is</strong></span>(<span class="methodparam"><span class="type"><a href="class.rararchive.html" class="type RarArchive">RarArchive</a></span> <code class="parameter">$rarfile</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   This function determines whether an archive is incomplete, i.e., if a volume is missing or a volume is truncated.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-rararchive.isbroken-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">rarfile</code></dt>

     <dd>

      <p class="para">
       A <span class="type"><a href="class.rararchive.html" class="type RarArchive">RarArchive</a></span> object, opened with <span class="function"><a href="rararchive.open.html" class="function">rar_open()</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-rararchive.isbroken-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>true</code></strong> if the archive is broken, <strong><code>false</code></strong> otherwise. This function may also
   return <strong><code>false</code></strong> if the passed file has already been closed. The only way
   to tell the two cases apart is to enable
   exceptions with <span class="methodname"><a href="rarexception.setusingexceptions.html" class="methodname">RarException::setUsingExceptions()</a></span>; however,
   this should be unnecessary as a program should not operate on closed files.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-rararchive.isbroken-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-803">
    <p><strong>示例 #1 面向对象风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">retnull</span><span style="color: #007700">()&nbsp;{&nbsp;return&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;&nbsp;}<br /></span><span style="color: #0000BB">$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"/multi_broken.part1.rar"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Third&nbsp;argument&nbsp;is&nbsp;used&nbsp;to&nbsp;omit&nbsp;notice&nbsp;*/<br /></span><span style="color: #0000BB">$arch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">RarArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">open</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'retnull'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$arch</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isBroken</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

     <div class="example-contents"><p>以上例程的输出类似于：</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
</pre></div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="example-804">
    <p><strong>示例 #2 过程化风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">retnull</span><span style="color: #007700">()&nbsp;{&nbsp;return&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;&nbsp;}<br /></span><span style="color: #0000BB">$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"/multi_broken.part1.rar"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Third&nbsp;argument&nbsp;is&nbsp;used&nbsp;to&nbsp;omit&nbsp;notice&nbsp;*/<br /></span><span style="color: #0000BB">$arch&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">rar_open</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'retnull'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">rar_broken_is</span><span style="color: #007700">(</span><span style="color: #0000BB">$arch</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
 </div>

 
  <div class="refsect1 seealso" id="refsect1-rararchive.isbroken-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="rararchive.setallowbroken.html" class="methodname" rel="rdfs-seeAlso">RarArchive::setAllowBroken()</a> - Whether opening broken archives is allowed</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>